# Maintainer: Jelle van der Waa <jelle@archlinux.org>

_pkgname=fold-debounce
pkgname=haskell-fold-debounce
pkgver=0.2.0.10
pkgrel=9
pkgdesc='Fold multiple events that happen in a given period of time'
arch=(loong64 x86_64)
url="https://hackage.haskell.org/package/$_pkgname"
license=(BSD)
depends=(ghc-libs haskell-stm-delay haskell-data-default-class)
checkdepends=(haskell-hspec haskell-hspec-discover)
makedepends=(ghc)
source=("https://hackage.haskell.org/packages/archive/$_pkgname/$pkgver/$_pkgname-$pkgver.tar.gz")
sha512sums=('8e278d174bdeec6970dafc44a6a1252897bbad6baa835e4e883aa070bdd43e16d0100374f2624a107725645dcdd8848019748bdaa5db1de5652d331442d399fa')

build() {
  cd $_pkgname-$pkgver
  runhaskell Setup configure -O --enable-shared --enable-executable-dynamic --disable-library-vanilla \
      --prefix=/usr --docdir=/usr/share/doc/$pkgname --datasubdir=$pkgname --enable-tests \
      --dynlibdir=/usr/lib --libsubdir=\$compiler/site-local/\$pkgid --ghc-option=-fllvm
  runhaskell Setup build $MAKEFLAGS
  runhaskell Setup register --gen-script
  runhaskell Setup unregister --gen-script
  sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
  sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
}

check() {
  cd $_pkgname-$pkgver
  runhaskell Setup test --show-details=direct
}

package() {
  cd $_pkgname-$pkgver
  install -D -m744 register.sh "$pkgdir"/usr/share/haskell/register/$pkgname.sh
  install -D -m744 unregister.sh "$pkgdir"/usr/share/haskell/unregister/$pkgname.sh
  runhaskell Setup copy --destdir="$pkgdir"
  install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
  rm -f "$pkgdir"/usr/share/doc/$pkgname/LICENSE
}

# vim: ts=2 sw=2 et:
